<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>4812： [Ynoi2017]由乃打扑克</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix"> [Ynoi2017]由乃打扑克</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix"> [Ynoi2017]由乃打扑克</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                 [Ynoi2017]由乃打扑克                </h1>
                <p>时间限制：59s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：666MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div>由乃不太会打扑克</div>
<div>所以她出了一个数据结构题&nbsp;</div>
<div>给一个N个点树，第i个点的点权为Ai，M次操作， 每次求一些树链的并的贡献，强制在线</div>
<div>贡献定义：</div>
<div>定义权值集合为这些树链的并里面出现过的所有点权的集合</div>
<div>权值集合中每一段连续出现的数的贡献为这一段长度的k次方</div>
<div>例如出现了1,9,2,6,0,8,1,7这些数，k=3的时候贡献为3^3+4^3，因为0,1,2是连续一段，6,7,8,9为连续一段</div>
<div>每次询问给出x条树链，以及一个k，贡献对2^32取模</div>
<div><img src="../file/4812_0.png" width="746" height="621" alt="" /></div>
<p></p></p><hr/><h3>输入格式</h3><p><div>一行两个整数N,M</div>
<div>接下来一行N个整数， 第i个整数表示Ai</div>
<div>接下来N-1行每行两个数u,v， 用来描述树上的一条边, 1&le;u,v&le;N</div>
<div>接下来M行， 每行首先给出一个数x， 接下来2x个数， 读入的这2x个数需要异或上一次询问的答案解密得到，初</div>
<div>始答案为0， 得到的第2i+1以及2i+2个数表示第i条链的起点以及终点， 最后一个数k</div>
<div>0&le;N,M&le;10^5, 0&le;&sum;x&le;10^5, 0&le;k&le;30, 0&le;Ai&le;30000</div>
<p></p></p><hr/><h3>输出格式</h3><p><div>对于每个询问输出一个数表示答案</div>
<p></p></p><hr/><h3>样例输入</h3><pre>8 2
1 9 2 6 0 8 1 7
1 2
2 3
3 4
4 5
5 6
6 7
7 8
2 1 4 5 8 3
1 90 90 2</pre><hr/><h3>样例输出</h3><pre>91
1
</pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>By 佚名提供</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=4812" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=4812" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>